home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / imap / ANSI / c-client / rfc822.h < prev    next >
C/C++ Source or Header  |  1996-02-06  |  6KB  |  128 lines

  1. /*
  2.  * Program:    RFC-822 routines (originally from SMTP)
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    27 July 1988
  13.  * Last Edited:    22 January 1996
  14.  *
  15.  * Sponsorship:    The original version of this work was developed in the
  16.  *        Symbolic Systems Resources Group of the Knowledge Systems
  17.  *        Laboratory at Stanford University in 1987-88, and was funded
  18.  *        by the Biomedical Research Technology Program of the National
  19.  *        Institutes of Health under grant number RR-00785.
  20.  *
  21.  * Original version Copyright 1988 by The Leland Stanford Junior University
  22.  * Copyright 1996 by the University of Washington
  23.  *
  24.  *  Permission to use, copy, modify, and distribute this software and its
  25.  * documentation for any purpose and without fee is hereby granted, provided
  26.  * that the above copyright notices appear in all copies and that both the
  27.  * above copyright notices and this permission notice appear in supporting
  28.  * documentation, and that the name of the University of Washington or The
  29.  * Leland Stanford Junior University not be used in advertising or publicity
  30.  * pertaining to distribution of the software without specific, written prior
  31.  * permission.  This software is made available "as is", and
  32.  * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY
  33.  * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE,
  34.  * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  35.  * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
  36.  * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY
  37.  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  38.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  39.  * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF
  40.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  41.  *
  42.  */
  43.  
  44. /* Coddle certain compilers' 6-character symbol limitation */
  45.  
  46. #ifdef __COMPILER_KCC__
  47. #define rfc822_header rheadr
  48. #define rfc822_address_line radl
  49. #define rfc822_header_line rhdl
  50. #define rfc822_write_address rwaddr
  51. #define rfc822_address raddr
  52. #define rfc822_cat rcat
  53. #define rfc822_write_body_header rwbhdr
  54. #define rfc822_default_subtype rdfsty
  55. #define rfc822_parse_msg rpmsg
  56. #define rfc822_parse_content rpcont
  57. #define rfc822_parse_content_header rpcnth
  58. #define rfc822_parse_adrlist rpadrl
  59. #define rfc822_parse_address rpaddr
  60. #define rfc822_parse_group rpgrop
  61. #define rfc822_parse_mailbox rpmlbx
  62. #define rfc822_parse_routeaddr rpradr
  63. #define rfc822_parse_addrspec rpaspc
  64. #define rfc822_parse_phrase rpphra
  65. #define rfc822_parse_word rpword
  66. #define rfc822_cpy rcpy
  67. #define rfc822_quote rquot
  68. #define rfc822_cpy_adr rcpyad
  69. #define rfc822_skipws rskpws
  70. #define rfc822_skip_comment rskpcm
  71. #define rfc822_contents rcntnt
  72. #define rfc822_output routpt
  73. #define rfc822_encode_body_7bit renbd7
  74. #define rfc822_encode_body_8bit renbd8
  75. #define rfc822_base64 rbas64
  76. #define rfc822_binary rbinry
  77. #define rfc822_qprint rqprnt
  78. #define rfc822_8bit r8bit
  79. #endif
  80.  
  81. /* Function prototypes */
  82.  
  83. void rfc822_header (char *header,ENVELOPE *env,BODY *body);
  84. void rfc822_address_line (char **header,char *type,ENVELOPE *env,ADDRESS *adr);
  85. void rfc822_header_line (char **header,char *type,ENVELOPE *env,char *text);
  86. void rfc822_write_address (char *dest,ADDRESS *adr);
  87. void rfc822_address (char *dest,ADDRESS *adr);
  88. void rfc822_cat (char *dest,char *src,const char *specials);
  89. void rfc822_write_body_header (char **header,BODY *body);
  90. char *rfc822_default_subtype (unsigned short type);
  91. void rfc822_parse_msg (ENVELOPE **en,BODY **bdy,char *s,unsigned long i,
  92.                STRING *bs,char *host,char *tmp);
  93. void rfc822_parse_content (BODY *body,STRING *bs,char *h,char *t);
  94. void rfc822_parse_content_header (BODY *body,char *name,char *s);
  95. void rfc822_parse_adrlist (ADDRESS **lst,char *string,char *host);
  96. ADDRESS *rfc822_parse_address (ADDRESS **lst,ADDRESS *last,char **string,
  97.                    char *defaulthost);
  98. ADDRESS *rfc822_parse_group (ADDRESS **lst,ADDRESS *last,char **string,
  99.                  char *defaulthost);
  100. ADDRESS *rfc822_parse_mailbox (char **string,char *defaulthost);
  101. ADDRESS *rfc822_parse_routeaddr (char *string,char **ret,char *defaulthost);
  102. ADDRESS *rfc822_parse_addrspec (char *string,char **ret,char *defaulthost);
  103. char *rfc822_parse_phrase (char *string);
  104. char *rfc822_parse_word (char *string,const char *delimiters);
  105. char *rfc822_cpy (char *src);
  106. char *rfc822_quote (char *src);
  107. ADDRESS *rfc822_cpy_adr (ADDRESS *adr);
  108. void rfc822_skipws (char **s);
  109. char *rfc822_skip_comment (char **s,long trim);
  110. char *rfc822_contents (char **dst,unsigned long *dstl,unsigned long *len,
  111.                char *src,unsigned long srcl,unsigned short encoding);
  112.  
  113. #ifndef TCPSTREAM
  114. #define TCPSTREAM void
  115. #endif
  116. typedef long (*soutr_t) (TCPSTREAM *stream,char *string);
  117. typedef long (*rfc822emit_t) (char *t,ENVELOPE *env,BODY *body,soutr_t f,TCPSTREAM *s);
  118. long rfc822_output (char *t,ENVELOPE *env,BODY *body,soutr_t f,TCPSTREAM *s);
  119. void rfc822_encode_body_7bit (ENVELOPE *env,BODY *body);
  120. void rfc822_encode_body_8bit (ENVELOPE *env,BODY *body);
  121. long rfc822_output_body (BODY *body,soutr_t f,TCPSTREAM *s);
  122. void *rfc822_base64 (unsigned char *src,unsigned long srcl,unsigned long *len);
  123. unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len);
  124. unsigned char *rfc822_qprint (unsigned char *src,unsigned long srcl,
  125.                   unsigned long *len);
  126. unsigned char *rfc822_8bit (unsigned char *src,unsigned long srcl,
  127.                 unsigned long *len);
  128.